str_demo = 'helloworld'

#1
print(len(str_demo))
count = 0
new_str = ""
# for i in range(len(str_demo),len(str_demo)-5,-1):
#     new_str+=str_demo[i]
# print(new_str)
#2
print(str_demo+'good')

# print('helloworld{}'.format(""))
# print(str_demo.join(['good']))
#3
print(str_demo[0])
#4
print(str_demo[3])
#5
list_str = [s for s in str_demo]
print(list_str)
#6
print(str_demo.upper())
#7
print("HelloWOrld".lower())
#8
#find查找不到返回-1
#index抛出异常
print(str_demo.find('a'))
#9
print(str_demo.index('wor'))
#10
#切片  当作range用法
print(str_demo[0:4])
#11  helloworld
print(str_demo[-1:-5:-1])
#切片中,如果想要包含到底,就要省略写
print(str_demo[-4:])
print(str_demo[::2])
long_str = 'abcdefghijklmn'
print(long_str[6:11])
#13
print(str_demo.find('values'))
# 公共方法 判断的主体 in 数据容器
print('he' not in str_demo)
print(4 in [1,2,3])
#
print(str_demo.encode('ASCII'))
print(bytearray(str_demo,'utf-8').decode())

#
print(str_demo.endswith('txt'))
print(str_demo.startswith('hello'))


